feat: add app_context_changed event type#2633
Open
zimeg wants to merge 7 commits into
Open
Conversation
🦋 Changeset detectedLatest commit: 9bbfc4e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Draft
3 tasks
18aa667 to
3ee37fb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2633 +/- ##
=======================================
Coverage 88.90% 88.90%
=======================================
Files 63 63
Lines 10256 10256
Branches 452 452
=======================================
Hits 9118 9118
Misses 1117 1117
Partials 21 21
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…on setSuggestedPrompts Adds AppContextChangedEvent to @slack/types with typed entity discriminated union (channel_id, canvas_id, list_id, message_context). Also adds app_context field to GenericMessageEvent since the context is delivered inline on messages too. Makes thread_ts optional on AssistantThreadsSetSuggestedPromptsArguments in @slack/web-api since agent_view DMs don't require it.
4b3651b to
ed43a3a
Compare
Validated against live socket-mode payloads: - context.entities is optional — omitted when the context is empty or no referenced entity is visible to the user. - message_context value carries only message_ts and channel_id; drop the unobserved user_id field.
The server drops any message_context entity without a channel_id before emitting the event, so channel_id is always present on the wire. The optionality lived only in server-side input validation, not the payload.
Adds tsd coverage for AppContextChangedEvent and the GenericMessageEvent app_context field, with literals modeled on real socket-mode payloads: each entity kind narrows by type, entities is optional (empty context), and message_context requires channel_id.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds the
app_context_changedevent type to@slack/types. The event fires in the agent DM (agent_view) experience when the user's surrounding context changes (e.g. they navigate to a channel, canvas, list, or message).AppContextChangedEventto theSlackEventdiscriminated union, covering the context entity kinds:slack#/types/channel_id,slack#/types/canvas_id,slack#/types/list_id, andslack#/types/message_context.app_contextfield toGenericMessageEvent, since the same context is delivered inline on messages.Scoped to the type definitions only — handling the event is left to consumers (e.g. Bolt and the sample apps).
Testing
Subscribe to the event and let TypeScript narrow each entity by its
type:Requirements